/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.generator.command;

import ru.jSky.interfaces.JSkyMod;
import ru.jSky.interfaces.Major;
import ru.jSky.interfaces.additional.Templateable;

/**
 *
 * @author Rakev
 */
public class CreationWithTemplateCommand<T extends Major> extends CreationCommand<T> {

    public CreationWithTemplateCommand(JSkyMod editingMod, EdidGenerationByBaseStrategy edidGenerator) {
        super(editingMod, edidGenerator);
    }

    @Override
    public T apply(T baseItem) {
        T genetatedItem = super.apply(baseItem);
        if (genetatedItem instanceof Templateable) {
            ((Templateable) genetatedItem).setTemplate(baseItem);
        }
        return genetatedItem;
    }
}
